/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package Clases;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author pablo
 */
@Entity
@Table(catalog = "Corrector_URJC", schema = "")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "UsuarioPractica.findAll", query = "SELECT u FROM UsuarioPractica u"),
    @NamedQuery(name = "UsuarioPractica.findByPracticaFKDist", query = "SELECT u FROM UsuarioPractica u WHERE u.idPracticaFK = :idpracticaFK GROUP BY u.idUsuarioFK"),
    @NamedQuery(name = "UsuarioPractica.findByPracticaFKANDUsuarioFKt", query = "SELECT u FROM UsuarioPractica u WHERE u.idPracticaFK = :idpracticaFK AND u.idUsuarioFK = :idUsuarioFK"),
    @NamedQuery(name = "UsuarioPractica.findByPracticaFK", query = "SELECT u FROM UsuarioPractica u WHERE u.idPracticaFK = :idpracticaFK"),
    @NamedQuery(name = "UsuarioPractica.findByUsuarioAndPractica", query = "SELECT u FROM UsuarioPractica u WHERE u.idPracticaFK = :idpracticafk AND u.idUsuarioFK = :idusuariofk"),
    @NamedQuery(name = "UsuarioPractica.findByIdUsuarioPractica", query = "SELECT u FROM UsuarioPractica u WHERE u.idUsuarioPractica = :idUsuarioPractica"),
    @NamedQuery(name = "UsuarioPractica.findByNota", query = "SELECT u FROM UsuarioPractica u WHERE u.nota = :nota")})
public class UsuarioPractica implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(nullable = false)
    private Integer idUsuarioPractica;
    private Long nota;
    @JoinColumn(name = "idPracticaFK", referencedColumnName = "idPractica")
    @ManyToOne
    private Practica idPracticaFK;
    @JoinColumn(name = "idUsuarioFK", referencedColumnName = "idUsuario")
    @ManyToOne
    private Usuario idUsuarioFK;

    public UsuarioPractica() {
    }

    public UsuarioPractica(Integer idUsuarioPractica) {
        this.idUsuarioPractica = idUsuarioPractica;
    }

    public Integer getIdUsuarioPractica() {
        return idUsuarioPractica;
    }

    public void setIdUsuarioPractica(Integer idUsuarioPractica) {
        this.idUsuarioPractica = idUsuarioPractica;
    }

    public Long getNota() {
        return nota;
    }

    public void setNota(Long nota) {
        this.nota = nota;
    }

    public Practica getIdPracticaFK() {
        return idPracticaFK;
    }

    public void setIdPracticaFK(Practica idPracticaFK) {
        this.idPracticaFK = idPracticaFK;
    }

    public Usuario getIdUsuarioFK() {
        return idUsuarioFK;
    }

    public void setIdUsuarioFK(Usuario idUsuarioFK) {
        this.idUsuarioFK = idUsuarioFK;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idUsuarioPractica != null ? idUsuarioPractica.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof UsuarioPractica)) {
            return false;
        }
        UsuarioPractica other = (UsuarioPractica) object;
        if ((this.idUsuarioPractica == null && other.idUsuarioPractica != null) || (this.idUsuarioPractica != null && !this.idUsuarioPractica.equals(other.idUsuarioPractica))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "Clases.UsuarioPractica[ idUsuarioPractica=" + idUsuarioPractica + " ]";
    }
    
}
